package com.quizzer.system.convert;

import com.quizzer.common.utils.bean.BeanUtils;
import com.quizzer.system.domain.Subject;
import com.quizzer.system.dto.question.subject.SubjectAddDto;
import com.quizzer.system.dto.question.subject.SubjectOutputDto;
import com.quizzer.system.dto.question.subject.SubjectQueryDto;
import com.quizzer.system.dto.question.subject.SubjectUpdateDto;

/**
 * @author rong
 * @Description
 * @date 2025/10/7 20:51
 */
public class SubjectConverter {
    public static SubjectOutputDto toOutputDto(Subject entity) {
        if(entity == null) {
            return null;
        }
        SubjectOutputDto dto = new SubjectOutputDto();
        BeanUtils.copyBeanProp(dto,entity);
        return dto;
    }
    public static Subject toEntity(SubjectAddDto dto) {
        if(dto == null) {
            return null;
        }
        Subject entity = new Subject();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Subject toEntity(SubjectUpdateDto dto) {
        if(dto == null) {
            return null;
        }
        Subject entity = new Subject();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Subject toEntity(SubjectQueryDto dto) {
        if(dto == null) {
            return null;
        }
        Subject entity = new Subject();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
}
